import numpy as np
import matplotlib.pyplot as plt
import cv2 as cv

img = cv.imread('image/dili.jpg')

print(img.shape)
print(img.size)
print(img.dtype)
print(img.ndim)
cv.imshow('img',img)
cv.waitKey(0)
cv.destroyAllWindows()

b,g,r = cv.split(img)
cv.imshow('b',b)
cv.imshow('g',g)
cv.imshow('r',r)
cv.waitKey(0)
cv.destroyAllWindows()
#plt.imshow(img)
#plt.show()

img2 = cv.merge((b,g,r))
cv.imshow('img2',img2)
cv.waitKey(0)
cv.destroyAllWindows()

cv.imwrite('test.png',img)

#获得图形的属性
px = img[100,100]
blue = img[100,100,0]
img[100,100]=[255,255,255]

print(px)
print(blue)
